package utils

import (
	"strings"
	"fmt"
)

//SpliteAddr:拆分省市字符串
func SpliteAddr(strparm string) (city string, province string) {
	var (
		start  int
		arr    []string
		midStr string
		str    string
	)
	str = strings.Replace(strparm, " ", "", -1)
	str = strings.Replace(str, "\n", "", -1)
	start = strings.Index(str, "{")
	midStr = str[start+1 : len(str)-3]
	fmt.Printf("midStr-------------:%s\n", midStr)
	arr = strings.Split(midStr, ",")
	fmt.Printf("arr-----------------:%v\n", arr)
	start = strings.Index(arr[0], "\"")
	city = arr[0][start+1 : len(arr[0])-1]
	start = strings.Index(arr[1], "\"")
	province = arr[1][start+1:]
	return
}
